<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta content="This is Chris's Home Page" name="description">
    <meta content="Chris,Web,Music,photo" name="keywords">
    <meta content="text/html;charset=utf-8" http-equiv="content-type"/>
    <title>Hello JavaScript!</title>
    <script src="./js/seap_utils.js" type="text/javascript"></script>
    <script type="text/javascript">
        function test() {
            var xmlHttpReq = new XMLHttpRequest();
            var requestURL = "./grades.xml";
            xmlHttpReq.open("POST", requestURL, true);
            xmlHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
            xmlHttpReq.send(encodeURIComponent("name=zhangsan"));

            xmlHttpReq.onreadystatechange = function () {
                if (xmlHttpReq.readyState == 4) {
                    switch (xmlHttpReq.status) {
                        case 200:
                            document.getElementById("result").value = xmlHttpReq.responseText;
                            var datas = xmlHttpReq.responseXML;
                            document.body.appendChild(datas.firstChild);
                            break;
                        case 400:
                            alert("错误的请求！\nError Code:400!");
                            break;
                        case 403:
                            alert("拒绝请求！\nError Code:403!");
                            break;
                        case 404:
                            alert("请求地址不存在！\nError Code:404!");
                            break;
                        case 500:
                            alert("内部错误！\nError Code:500!");
                            break;
                        case 503:
                            alert("服务不可用！\nError Code:503!");
                            break;
                        default:
                            alert("请求返回异常！\nError Code:" + xmlHttpReq.status);
                            break;
                    }
                }
            }
        };

    </script>
</head>
<body>
<button onclick="test()">Test</button>
<br/><br/>
<textarea cols="100" id="result" rows="10"></textarea>
</body>
</html>
